/**
 * 
 */
package com.longrise.filedownloaderdemo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;
import android.view.animation.AlphaAnimation;
import android.widget.RelativeLayout;


/**
 * simple introduction
 * 
 * <p>
 * detailed comment
 * @author call 2015-12-31
 * @see
 * @since 1.0
 */
public class LaunchActivity extends Activity
{
    private RelativeLayout mRootView;

    /**
     * @see Activity#onCreate(Bundle)
     */
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_launch);
        initView();
        initFolder();
        initAnim();
        checkVersion();
    }

    private void initView()
    {
        mRootView = (RelativeLayout) findViewById(R.id.launch_root);

    }

    /**
     * 初始化软件的文件夹
     */
    private void initFolder(){
        FileUtil.createFolder(FolderConstants.VIDEO_DIR); //视频文件夹
    }
    
    private void initAnim()
    {
        AlphaAnimation aa = new AlphaAnimation(0, 1);
        aa.setDuration(1000);
        aa.setFillAfter(true);
        mRootView.setAnimation(aa);
    }

    private void checkVersion()
    {
        new Thread()
        {
            public void run()
            {
                SystemClock.sleep(2000);
                loadMain();
            };

        }.start();

    }

    private void loadMain()
    {
        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();
    }

}
